﻿@model CompanyViewModel
<div class="layui-colla-item">
	<h2 class="layui-colla-title layui-elem-quote">商户信息</h2>
	<div class="layui-colla-content layui-form layui-show" wid100>
		<div class="layui-form-item">
			<label class="layui-form-label">商户名称</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.CompanyName
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">LOGO</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">@Html.Raw(Utility.GetPicHtml(Model.Company.CompanyPic))</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">商户地址</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.Province@Model.Company.City@Model.Company.Area
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">联系地址</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.Address
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">邮政编码</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.ZipCode
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">联系电话</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.Phone
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">传真号码</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.Fax
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">网址</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.Homepage
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">简介</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.CompanyIntro
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">开户银行</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.BankOfDeposit
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">银行帐号</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.BankAccount
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">税号</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.TaxNum
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">行业地位</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">@ViewBag.StatusInField</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">公司规模</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">@ViewBag.CompanySize</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">业务范围</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.BusinessScope
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">年销售额</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.AnnualSales
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">经营状态</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">@ViewBag.ManagementForms</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">注册资本</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.RegisteredCapital
				</div>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">所属业务员</label>
			<div class="layui-input-block">
				<div class="layui-input-inline layui-input-company">
					@Model.Company.SalesManager @Model.Company.Sales
				</div>
			</div>
		</div>
		@{
			if (Model.CompanyOptionFieldList != null)
			{
				foreach (var item in Model.CompanyOptionFieldList)
				{
					<div class="layui-form-item">
						<label class="layui-form-label">@item.FieldAlias</label>
						<div class="layui-input-block">
							<div class="layui-input-inline layui-input-company">
								@await Component.InvokeAsync("FieldViewControl", new FieldControlViewModel { Prefix = "Company", ModelID = 101, IsAdminManage = true, DataSource = Model.CompanyOption, FieldName = item.FieldName, FieldValue = item.DefaultValue, FieldType = item.FieldType, FieldLevel = item.FieldLevel, FieldAlias = item.FieldAlias, Tips = item.Tips, Description = item.Description, Disabled = item.Disabled, EnableNull = item.EnableNull, Settings = item.Settings })
							</div>
						</div>
					</div>
				}
			}
		}
	</div>
</div>
<div class="layui-colla-item">
	<h2 class="layui-colla-title layui-elem-quote">商户成员</h2>
	<div class="layui-colla-content layui-show">
		<table class="layui-table" lay-filter="tblCompanyMember">
			<thead>
				<tr>
					<th lay-data="{field:'UserName', minWidth:100}">会员名</th>
					<th lay-data="{field:'TrueName', width:90}">姓名</th>
					<th lay-data="{field:'Email', width:100}">Email</th>
					<th lay-data="{field:'Mobile', width:100}">手机</th>
					<th lay-data="{field:'UserType', width:110}">类型</th>
					<th lay-data="{field:'UserID', width:210}">操作</th>
				</tr>
			</thead>
			<tbody>
				@{
					if (Model.CompanyMemberInfo != null)
					{
						foreach (System.Data.DataRow item in Model.CompanyMemberInfo.Rows)
						{
							<tr>
								<td>@item["UserName"].ToString()</td>
								<td>@item["TrueName"].ToString()</td>
								<td>@item["Email"].ToString()</td>
								<td>@item["Mobile"].ToString()</td>
								<td>@EnumHelper.GetDescription((UserTypeEnum)item["UserType"])</td>
								<td>
									@switch (item["UserType"].ToString())
									{
										case "1":
											break;
										case "2"://管理员
											<button class="layui-btn layui-btn-xs" type="button" onclick="RemoveFromCompany('@item["UserName"].ToString()')">从商户中移除</button>
											<button class="layui-btn layui-btn-xs" type="button" onclick="RemoveFromCompanyAdmin('@item["UserName"].ToString()')">降为普通成员</button>
											break;
										case "3"://普通成员
											<button class="layui-btn layui-btn-xs" type="button" onclick="RemoveFromCompany('@item["UserName"].ToString()')">从商户中移除</button>
											<button class="layui-btn layui-btn-xs" type="button" onclick="AddToCompanyAdmin('@item["UserName"].ToString()')">升级为管理员</button>
											break;
										case "4"://待审核成员
											<button class="layui-btn layui-btn-xs" type="button" onclick="AgreeJoinCompany('@item["UserName"].ToString()',@Model.Company.ClientID)">批准加入</button>
											<button class="layui-btn layui-btn-xs" type="button" onclick="RejectToCompany('@item["UserName"].ToString()')">拒绝加入</button>
											break;
										default:
											<button class="layui-btn layui-btn-xs" type="button" onclick="RemoveFromCompany('@item["UserName"].ToString()')">从商户中移除</button>
											<button class="layui-btn layui-btn-xs" type="button" onclick="AddToCompanyAdmin('@item["UserName"].ToString()')">升级为管理员</button>
											break;
									}

								</td>
							</tr>
						}
					}
				}
			</tbody>
		</table>
	</div>
</div>
@Html.AntiForgeryToken()
<script type="text/javascript">
	jQuery(function () {
		layui.use('table', function () {
			var table = layui.table;
			table.init('tblCompanyMember', {

			});
		});
	});
</script>